package xin.marcher.module.scheduling.job.replenished;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;
import xin.marcher.module.common.core.JsonResult;
import xin.marcher.module.replenished.api.RecoverableApi;
import xin.marcher.module.replenished.domain.request.RecoverableRequest;

/**
 * 商品可采定时任务
 */
@Slf4j
@Component
public class RecoverableJobHandler {

    @DubboReference(version = "1.0.0")
    private RecoverableApi recoverableApi;

    @XxlJob("syncRecoverableProduct")
    public void syncAvailableProduct(RecoverableRequest request) {
        XxlJobHelper.log("sync available product job starting...");
        JsonResult result = recoverableApi.syncRecoverableProduct(request);
        XxlJobHelper.log("sync available product job end, result:{}", result);
    }
}
